package com.compass.mobile.network.api


import com.compass.mobile.models.AiDataWarp
import com.compass.mobile.models.AllDictionariesWarp
import com.compass.mobile.models.AppointmentWarp
import com.compass.mobile.models.Dictionaries
import com.compass.mobile.models.ArticleBeanWarp
import com.compass.mobile.models.AssessmentBean
import com.compass.mobile.models.CaseHistory
import com.compass.mobile.models.Classify
import com.compass.mobile.models.CommonBean
import com.compass.mobile.models.DepartmentBean
import com.compass.mobile.models.DepartmentBeanWarp
import com.compass.mobile.models.Doctor
import com.compass.mobile.models.DoctorHomePageWarp
import com.compass.mobile.models.DoctorInfo
import com.compass.mobile.models.DoctorWarp
import com.compass.mobile.models.EquityBean
import com.compass.mobile.models.HealthDataWarp
import com.compass.mobile.models.HealthForDate
import com.compass.mobile.models.HomeMenuWarp
import com.compass.mobile.models.HospitalBean
import com.compass.mobile.models.IndependentBillingBean
import com.compass.mobile.models.Inspection
import com.compass.mobile.models.InspectionReport
import com.compass.mobile.models.InspectionWarp
import com.compass.mobile.models.MedicalRecordReportWarp
import com.compass.mobile.models.MsgWarp
import com.compass.mobile.models.NotificationWarp
import com.compass.mobile.models.Nurse
import com.compass.mobile.models.NursingOrderWarp
import com.compass.mobile.models.OrderBean
import com.compass.mobile.models.OrderBeanWarp
import com.compass.mobile.models.PatientBean
import com.compass.mobile.models.PrescriptionRecordWarp
import com.compass.mobile.models.SuggestMessageInfo
import com.compass.mobile.models.TicketModelWarp
import com.compass.mobile.models.UpdateInfo
import com.compass.mobile.models.User
import com.compass.mobile.models.YDUser
import com.compass.mobile.network.response.BaseResponse
import com.compass.mobile.network.response.RefreshTokenResponse
import com.google.gson.JsonObject
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Url


/**
 *
 * @desc   API接口类
 */
interface ApiInterface {


    //登录接口
    @POST("open/user/patient/auth/yd-box-login")
    suspend fun boxLogin(@Body responseBody: JsonObject): BaseResponse<User?>

    //获取验证码
    @POST("open/user/patient/auth/send-Login-code")
    suspend fun getCode(@Body responseBody: JsonObject): BaseResponse<User?>    //获取验证码

    @POST
    suspend fun healthAssessment(
        @Url url: String,
        @Body responseBody: JsonObject
    ): BaseResponse<AssessmentBean?>

    @POST
    suspend fun intelligentGuidance(
        @Url url: String,
        @Body responseBody: AiDataWarp
    ): BaseResponse<MsgWarp?>

    @GET
    suspend fun commonSymptoms(
        @Url url: String,
        @Query("age") age: String?,
        @Query("gender") gender: String?
    ): BaseResponse<MutableList<CommonBean>?>

    /**
     * 设置投诉类型
     */
    @POST("open/information/complaint-suggest/install-type?")
    suspend fun setSuggestType(
        @Query("type") type: String?
    ): BaseResponse<Any?>


    /**
     * 获取投诉建议
     */
    @GET("open/information/suggest-detail/list")
    suspend fun getSuggestList(): BaseResponse<MutableList<SuggestMessageInfo>?>

    //检测
    @POST("open/user/patient/auth/mobile-check")
    suspend fun checkMobileSync(@Body responseBody: JsonObject): BaseResponse<MutableList<PatientBean>?>

    //新增投诉
    @POST("open/information/suggest-detail/create")
    suspend fun createSuggest(@Body responseBody: JsonObject): BaseResponse<Any?>

    //手机号同步患者
    @POST("open/user/patient/auth/mobile-sync")
    suspend fun getMobileSync(@Body responseBody: JsonObject): BaseResponse<Any?>

    //提交检验检查
    @POST("open/hospital/inspection/self-add")
    suspend fun submitInspection(@Body responseBody: JsonObject): BaseResponse<Any?>


    //提交检验检查
    @POST("open/user/healthy-log/get-measurement-by-date")
    suspend fun getMeasurement(@Body responseBody: JsonObject): BaseResponse<MutableList<HealthForDate>>

    //提交检验检查
    @GET("open/user/healthy-log/home")
    suspend fun getHealthy(@Query("patientId") patientId: String?): BaseResponse<HealthDataWarp?>


    //医院列表
    @GET("basics/hospital/list")
    suspend fun getHospitalList(): BaseResponse<MutableList<HospitalBean>?>

    //获取默认就诊人
    @GET("open/user/patient-with-treatment/get-default")
    suspend fun getDefPatient(): BaseResponse<PatientBean?>


    //首页菜单
    @GET("basics/hospital-config/menu-config")
    suspend fun getMenuConfig(): BaseResponse<HomeMenuWarp?>

    //搜索荐医生
    @GET("open/user/patient-my-doctor/search-doctors")
    suspend fun searchDoctors(@Query("keywords") keywords: String?,@Query("type") type: Int): BaseResponse<MutableList<Doctor>?>


    //护理分类
    @GET("open/collaboration/nurse/project-classify/getClassify")
    suspend fun getClassify(): BaseResponse<MutableList<Classify>?>

    //护理分类--更多护理
    @GET("open/collaboration/nurse/project/get-more-nurse-project")
    suspend fun getMoreNurse(@Query("classifyId") id: String): BaseResponse<MutableList<Nurse>?>

    //护理分类--护理详情
    @GET("open/collaboration/nurse/project/detail")
    suspend fun geNurseDetail(@Query("id") id: String?): BaseResponse<Nurse?>


    //获取护理  热门服务
    @GET("open/collaboration/nurse/project/get-hot-nurse-service")
    suspend fun geHotNurse(@Query("dataNum") dataNum: String?): BaseResponse<MutableList<Nurse>?>

    //问诊单详情
    @GET("open/collaboration/order-consultation/get-patient")
    suspend fun gePatientOrderDetails(@Query("id") id: String?): BaseResponse<OrderBean?>

    //获取当前就诊人最近问诊的状态
    @GET("basics/benefit-user/check-benefit")
    suspend fun getLastInquiryStatus(
        @Query("type") type: String,
        @Query("patientId") patientId: String
    ): BaseResponse<String?>

    //获取当前用户权益
    @GET("basics/benefit-user/check-benefit")
    suspend fun checkBenefit(@Query("type") type: String?): BaseResponse<MutableList<EquityBean>?>

    //提交问诊单

    @POST("open/collaboration/order-consultation/tv-create")
    suspend fun submitCollaboration(@Body responseBody: JsonObject): BaseResponse<String?>

    //获取科室列表--在线问诊
    @GET("open/hospital/department/get-dept-list")
    suspend fun geDeptList(
        @Query("name") dataNum: String?,
        @Query("limit") limit: Int?
    ): BaseResponse<MutableList<DepartmentBean>?>

    @GET("open/collaboration/order-consultation/validate-patient-order-consultation")
    suspend fun checkOrderStatus(
        @Query("type") type: String,
        @Query("doctorId") doctorId: String,
        @Query("patientId") patientId: String
    ): BaseResponse<OrderBean?>

    //获取科室列表--在线问诊--首字母
    @GET("open/hospital/department/get-dept-list-two-out")
    suspend fun getLetterDeptList(@Query("name") dataNum: String?): BaseResponse<Map<String, MutableList<DepartmentBean>?>?>


    //获取科室列表--预约挂号--首字母
    @GET("open/hospital/department/get-dept-list-two-move")
    suspend fun geDeptListTwo(
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<Map<String, MutableList<DepartmentBean>?>?>

    //获取科室列表--预约挂号--推荐在前
    @GET("open/hospital/department/get-dept-list-move")
    suspend fun geDeptListTwoBySort(
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?,
        @Query("name") name: String?,
    ): BaseResponse<MutableList<DepartmentBean>?>

    //获取科室列表--预约挂号
    @GET("open/hospital/order-inspection/get-by-id")
    suspend fun geInspectionOrder(@Query("orderId") orderId: String?): BaseResponse<Inspection?>

    //获取推荐医生

    @GET("open/user/doctor/info/get-home-recommend-doctor-page-ipad")
    suspend fun geRecommendDoctor(
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<DoctorWarp?>

    //获取科室详情
    @GET("open/hospital/department/get-dept-info-and-statistics")
    suspend fun geDeptDetails(@Query("deptId") deptId: String?): BaseResponse<DepartmentBean?>

    //取消问诊
    @GET("open/collaboration/order-consultation/consultation-order-cancel")
    suspend fun consultationOrder(@Query("orderId") orderId: String?): BaseResponse<Any?>

    //获取医生列表--在线问诊
    @GET("open/user/doctor/info/get-home-recommend-doctor-page")
    suspend fun geDoctors(
        @Query("department") deptId: String?,
        @Query("type") type: Int?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<DoctorWarp?>

    //获取医生列表--预约
    @GET("open//user/doctor/info/get-home-recommend-doctor-move-page")
    suspend fun geRecommendDoctors(
        @Query("codeDept") codeDept: String?,
        @Query("onlyHaveSch") onlyHaveSch: Int?,
        @Query("onlyExpert") onlyExpert: Int?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<DoctorWarp?>

    //获取医生列表
    @POST("open/hospital/order-inspection/get-report-list?")
    suspend fun geReportList(@Body responseBody: JsonObject): BaseResponse<MutableList<InspectionReport>?>

    /**
     * 获取检查检验自主开单项目
     */
    @GET("open/hospital/inspection/list-patient")
    suspend fun getInspectionProjectList(
        @Query("type") type: String?
    ): BaseResponse<Map<String, MutableList<IndependentBillingBean>>?>


    /**
     * 医生主页
     */
    @GET("open/user/doctor/info/home-page")
    suspend fun getDoctorHomePage(
        @Query("doctorId") doctorId: String?,
        @Query("patientId") patientId: String?,
        @Query("departmentId") departmentId: String?
    ): BaseResponse<DoctorHomePageWarp?>

    /**
     * 预约号源列表查询
     */
    @GET("open/user/reservation-registration/get-tickets")
    suspend fun getTickets(
        @Query("pkSch") pkSch: String?
    ): BaseResponse<TicketModelWarp?>


    /**
     * 预约挂号确认
     */
    @POST("open/user/reservation-registration/save-appointment")
    suspend fun saveAppointment(
        @Body responseBody: JsonObject
    ): BaseResponse<Any?>

    @GET("open/user/doctor/info/get-wyyx")
    suspend fun getDoctorInfo(
        @Query("doctorWyyx") doctorWyyx: String
    ): BaseResponse<DoctorInfo?>

    /**
     * 医生主页--资讯
     */
    @GET("open/information/app-patient-special-column-journalism/getArticleList")
    suspend fun getArticleList(
        @Query("doctorId") doctorId: String?,
        @Query("type") type: String?,
        @Query("pageNo") pageNo: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<ArticleBeanWarp?>

    /**
     * 获取问诊列表
     */
    @GET("open/collaboration/order-consultation/consultation-order-page")
    suspend fun getConsultationList(
        @Query("patientId") patientId: String?,
        @Query("type") type: String?,
        @Query("pageNo") pageNo: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<OrderBeanWarp?>

    /**
     * 获取护理订单
     */
    @GET("open/collaboration/nurse/getOrderNursePage")
    suspend fun getOrderNurse(
        @Query("statusGroup") type: String?,
        @Query("pageNo") pageNo: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<NursingOrderWarp?>


    /**
     * 获取我得预约列表
     */
    @GET("open//user/reservation-registration/get-pi-appointment?")
    suspend fun getAppointmentList(
        @Query("patientId") patientId: String?,
        @Query("type") type: String?,
        @Query("pageNo") pageNo: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<AppointmentWarp?>

    /**
     * 取消预约
     */
    @GET("open/user/reservation-registration/cancel-appointment")
    suspend fun cancelAppointment(
        @Query("pkSchappt") patientId: String?
    ): BaseResponse<Any?>

    /**
     * 获取检查检验订单分页查询
     */
    @GET("open/hospital/order-inspection/list")
    suspend fun getInspectionList(
        @Query("patientId") patientId: String?,
        @Query("type") type: String?,
        @Query("pageNo") pageNo: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<InspectionWarp?>

    /**
     * 医生主页--关注/取消关注
     */
    @POST("open/user/patient-user-follow/follow")
    suspend fun follow(
        @Query("doctorId") doctorId: String?,
        @Query("patientId") patientId: String?
    ): BaseResponse<String?>

    /**
     * 检测就诊人是否改动
     */
    @GET("open/third/yd/check-operation")
    suspend fun checkPatient(@Query("randomStr") randomStr: String?): BaseResponse<String?>


    /**
     * 获取医院配置信息
     */
    @GET("open/hospital/config/get-hospital-config-by-key?")
    suspend fun getHosConfig(
        @Query("key") doctorId: String = "inspection.pacs"
    ): BaseResponse<String?>


    //消息分页查询
    @GET("open/user/with-treatment-system-messages/page")
    suspend fun geMessage(
        @Query("patientId") patientId: String?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?,
        @Query("readStatus") deptId: String?,
    ): BaseResponse<NotificationWarp?>

    //根据token获取手机号
    @GET("yd/get-user")
    suspend fun geUserPhoneForToken(
        @Query("token") token: String?,
    ): BaseResponse<YDUser?>

    //病历分页查询--患者自己传的
    @GET("open/user/medical-records/list-page")
    suspend fun caseHistoryPatient(
        @Query("patientId") patientId: String?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<MedicalRecordReportWarp?>

    //病历查询 --医生传的
    @GET("open/collaboration/order-consultation-case/get-consultation-case-list")
    suspend fun caseHistory(
        @Query("patientId") patientId: String?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?
    ): BaseResponse<MutableList<CaseHistory>?>

    //申请续方
    @POST("open/prescription/order-prescription/apply-continue-prescription")
    suspend fun continuePrescription(
        @Query("id") id: String?
    ): BaseResponse<Any?>

    //处方列表 分页
    @GET("open/prescription/order-prescription/get-my-prescriptions")
    suspend fun prescriptionRecords(
        @Query("patientId") patientId: String?,
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?,
        @Query("status") status: String?
    ): BaseResponse<PrescriptionRecordWarp?>


    //就诊人
    @GET("open/user/patient-with-treatment/page")
    suspend fun gePatients(
        @Query("pageNo") page: Int?,
        @Query("pageSize") pageSize: Int?,
    ): BaseResponse<MutableList<PatientBean>?>

    //切换就诊人
    @GET("open/user/patient-with-treatment/switch")
    suspend fun geSwitchPatients(
        @Query("id") id: String?
    ): BaseResponse<Any?>

    //解绑就诊人
    @POST("open/user/patient-with-treatment/unbind-patient?")
    suspend fun geUnbindPatients(
        @Query("id") id: String?
    ): BaseResponse<Any?>

    //添加就诊人
    @POST("open/user/patient-with-treatment/saveOrUpdate2")
    suspend fun addPatients(@Body responseBody: JsonObject): BaseResponse<Any?>

    @POST("open/information/complaint-suggest/create")
    suspend fun saveInformation(
        @Query("content") content: String,
        @Query("contactWay") contactWay: String
    ): BaseResponse<Any?>

    //获取指定字典
    @GET("open/system/dict-data/type?")
    suspend fun getDictionaries(@Query("type") type: String): BaseResponse<MutableList<Dictionaries>?>

    //获取全部字典
    @GET("open/system/dict-data/build")
    suspend fun getDictionaries(): BaseResponse<AllDictionariesWarp?>

    //获取医院某个配置
    @GET("open/hospital/hosptial-info/get-hospital-config")
    suspend fun getHospitalConfig(@Query("paramsKey") paramsKey:String): BaseResponse<String?>

    //获取医生咨询设置
    @GET("open/infra/apk-version/query-latest-version?")
    suspend fun getAppVersion(@Query("type") key: String): BaseResponse<UpdateInfo?>
    /**
     * 单独刷新token
     */
    @POST("user/doctor/auth/refresh-token?")
    fun refreshTokenFlow(@Query("refreshToken") refreshToken: String): Call<BaseResponse<RefreshTokenResponse>>


}